package com.wryyyyy.controller;

import com.wryyyyy.dto.Result;
import com.wryyyyy.entity.Device;
import com.wryyyyy.service.IDeviceService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author wryyyyy
 * @since 2024-05-14
 */
@RestController
@RequestMapping("/device")
public class DeviceController {
    @Resource
    private IDeviceService deviceService;

    /**
     * 根据factoryId获取设备列表
     * @param factoryId 污水厂Id
     * @return 模型列表
     */
    @GetMapping("/list")
    public Result getList(
            @RequestParam(value = "factoryId", required = false) String factoryId
    ) {
        return deviceService.queryByFactory(factoryId);
    }
}